import http from "../request";
const apibase = "/api/JobItem";

//获取工作模板中的项
var getJobItems = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/GetJobItems`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//新增工作模板中的项
var addJobItems = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/AddJobItems`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//修改工作模板的项
var updateJobItmes = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/UpdateJobItmes`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//删除工作模板的项

var deleteJobItmes = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/DeleteJobItmes`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//修改约束
var modifyJobItemConstraint = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/ModifyJobItemConstraint`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//获取单例展示
var getJobItemsGroup = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/GetJobItemsGroup`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};
export {
  getJobItems,
  addJobItems,
  updateJobItmes,
  deleteJobItmes,
  modifyJobItemConstraint,
  getJobItemsGroup
};
